<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">
<!--
td{
	width: auto;
	height: auto;
	border-bottom-style: double;
	border-bottom-color: #999999;
	border-left-style: groove;
	padding-top: 5px;
	padding-right: 5px;
	padding-bottom: 5px;
	padding-left: 5px;
	border-right-style: none;
}
.Title_text{
	color: #FFFFFF;
}
.odd{
	background-color: #ECEFE7;
}
.even{
	background-color: #C2D584;
}
.STYLE1 {color: #297416}
-->
</style>

 <script type="text/javascript">
	   function goto_page(){
			var pagenumber = page_no.value;
			//alert(pagenumber);
			/*这里可以添加校验操作
			 *if(pagenumber<0)...
			 */
			location.href="tanweilin/User_list.action?pageNumber="+pagenumber;
			return;
		}
	   function delete_user() {
			var name = arguments[0];
			//alert(name);
			msg='确认要删除"'+name+'"用户吗？';
			if(window.confirm(msg)) {
				URL="tanweilin/User_delete.action?username="+name;
				window.location=URL;
			}
	   }
	   
</script>


<title>User list</title>
</head>

<body>
<h2 align="center">
	<span class="STYLE1">
		分页显示用户
	</span><br />
</h2>
<a href="tanweilin/login.action">安全退出</a>
共<s:property value="page.getTotalCount()"/>条记录     
共<s:property value="page.getTotalPages()"/>页         
 第<s:property value="page.getCurrentPage()"/>页  
<br /><hr /><br />


<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr bgcolor="#006600">
      <td class="Title_text">姓名</td>
      <td class="Title_text">密码</td>	

</tr>
      <s:iterator value="users" var="u" status="status">
      <tr>
      <s:if test="#status.even">
       <td class="even"><s:property value = "#u.username" /></td>
       <td class="even"><s:property value = "#u.password" /></td>
       <td class="even">
       	 <a href="tanweilin/User_updateInput.action?username=<s:property value="#u.username"/>">更新用户</a>
	     <a href="javascript:delete_user('<s:property value="#u.username"/>');">删除用户</a>
	   </td>
	   </s:if>	   
	   <s:else>
	   	 <td class="odd"><s:property value = "#u.username" /></td>
       <td class="odd"><s:property value = "#u.password" /></td>
       <td class="odd">
       	 <a href="tanweilin/User_updateInput.action?username=<s:property value="#u.name"/>">更新用户</a>
	     <a href="javascript:delete_user('<s:property value="#u.name"/>');">删除用户</a>
	   </td>	   
	   </s:else>
    </tr>     
    </s:iterator>  
    
</table>

<!-- 分页功能 -->
<br /><hr />
<div align="left">
跳转到第<input type="text" size="3" name="page_no"/>页<input type="button" onclick="" value="GO"/>
</div>

<div align="right">
	<a href="xiaobai/UserAction!list.action?pageNumber=1" >首页</a>
	
	<s:if test="pageNumber==1">
	 	<a href="xiaobai/UserAction!list.action?pageNumber=1" >上一页</a>   
        <a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="pageNumber+1"/>">下一页</a> 
	</s:if>
	<s:elseif test="pageNumber==page.getTotalPages()">
		<a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="pageNumber-1"/>" >上一页</a>   
        <a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="page.getTotalPages()"/>">下一页</a> 
	</s:elseif>
	<s:else>
		<a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="pageNumber-1"/>" >上一页</a>   
        <a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="pageNumber+1"/>">下一页</a> 
	</s:else>     
       
    <a href="xiaobai/UserAction!list.action?pageNumber=<s:property value="page.getTotalPages()"/>" >最后一页</a>  
        <br/>  
</div>
<!-- end of 分页功能 -->

</body>
</html>

















